proc lang_add {lang full} {
global langlist
set lang [string tolower $lang]
set fu "(full)"
	if {[lsearch -exact $langlist "$lang"]==-1} {
		lappend langlist $lang
		global $lang
		set "$lang$fu" $full
	} else {
		global $lang
		if {![info exists "$lang$fu"]} {
			set "$lang$fu" $full
		}
	}
}

proc lang_set {lang cat txt val} {
set lang [string tolower $lang]
global langlist
   if {[lsearch -exact $langlist "$lang"]==-1} {
      error "wrong lang in language pack ($lang)"
   }

global category
   if {[lsearch -exact $category "$cat"]==-1} {
      error "wrong category in language pack ($cat)"
   }
   set text [string tolower $txt]
   set text "($txt)"
   set "$lang$text" $val
}

proc lang_get {lang cat txt} {
set lang [string tolower $lang]
global langlist
   if {[lsearch -exact $langlist "$lang"]==-1} {
      error "wrong lang in language pack ($lang)"
   }
global category
   
   if {[lsearch -exact $category "$cat"]==-1} {
      error "wrong category in language pack ($cat)"
   }
global $lang
set text [string tolower $txt]
set txt "($text)"
	if {[info exists "$lang$txt"]==1} {
		return "$lang$txt"
	} else {
		return "(Def): $txt"
	}
}
